package com.alibaba.dongbao.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * 用户表
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "user")
public class User implements Serializable {
    /**
     * id
     */
    @TableId(value = "user_id", type = IdType.NONE)
    private Long userId;

    /**
     * 用户名
     */
    @TableField(value = "username")
    @NotNull(message = "用户名不能为空")
    @NotEmpty(message = "用户名不能传空")
    @Size(min = 2,max = 8,message = "用户不能不能小于2位或者大于8位")
    private String username;

    /**
     * 密码
     */
    @TableField(value = "password")
    @NotNull(message = "密码不能为空")
    @NotEmpty(message = "密码不能传空")
    @Size(min = 6,max = 16,message = "用户不能小于6位或者大于16位")
    private String password;

    /**
     * 真实姓名
     */
    @TableField(value = "name")
    @NotNull(message = "真实姓名不能为空")
    @NotEmpty(message = "真实姓名不能传空")
    @Size(min = 1,max = 8,message = "真实姓名不能小于1位或者大于8位")
    private String name;

    /**
     * 手机号
     */
    @TableField(value = "phone")
    private String phone;

    /**
     * 头像
     */
    @TableField(value = "icon")
    private String icon;

    /**
     * 邮箱
     */
    @TableField(value = "email")
    @Email
    private String email;

    /**
     * 昵称
     */
    @TableField(value = "nick_name")
    private String nickName;

    /**
     * 备注
     */
    @TableField(value = "note")
    private String note;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create",fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified",fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date gmtModified;

    /**
     * 登录时间
     */
    @TableField(value = "login_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date loginTime;

    /**
     * 是否删除(0=未删除，1=删除)
     */
    @TableField(value = "is_delete")
    private Integer isDelete;

    private static final long serialVersionUID = 1L;
}